/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package View;

import Utility.AjustaIcon;
import Utility.DataHoraUtil;
import Utility.Relogio;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 *
 * @author Thiago
 */
public class Home extends javax.swing.JFrame {

    /**
     * Creates new form Home
     */
    public Home() {
        initComponents();        
       // AjustaIcon.ajustaTelaFullScreen(this); 
        DataHoraUtil.setData(dataRespLabel);  
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        topPanel = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        CadClienteBtn = new javax.swing.JButton();
        vendaBtn = new javax.swing.JButton();
        footerPanel = new javax.swing.JPanel();
        userLabel = new javax.swing.JLabel();
        userRespLabel = new javax.swing.JLabel();
        dataLabel = new javax.swing.JLabel();
        dataRespLabel = new javax.swing.JLabel();
        horaLabel = new javax.swing.JLabel();
        horaRespLabel = new Relogio();
        logoLabel = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        CadastroJmenu = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        sairJmenu = new javax.swing.JMenu();
        jMenuItem4 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Modulo de Pagamento");
        setBackground(new java.awt.Color(102, 102, 102));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        topPanel.setBackground(new java.awt.Color(153, 153, 153));

        jToolBar1.setBackground(new java.awt.Color(153, 153, 153));
        jToolBar1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        CadClienteBtn.setBackground(new java.awt.Color(153, 153, 153));
        CadClienteBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/add-female-user (4).png"))); // NOI18N
        CadClienteBtn.setFocusable(false);
        CadClienteBtn.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        CadClienteBtn.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        CadClienteBtn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CadClienteBtnActionPerformed(evt);
            }
        });
        jToolBar1.add(CadClienteBtn);

        vendaBtn.setBackground(new java.awt.Color(153, 153, 153));
        vendaBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/Custom-Icon-Design-Pretty-Office-6-Shopping-basket-add (4).png"))); // NOI18N
        vendaBtn.setFocusable(false);
        vendaBtn.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        vendaBtn.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(vendaBtn);

        javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
        topPanel.setLayout(topPanelLayout);
        topPanelLayout.setHorizontalGroup(
            topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        topPanelLayout.setVerticalGroup(
            topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        footerPanel.setBackground(new java.awt.Color(153, 153, 153));
        footerPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        footerPanel.setPreferredSize(new java.awt.Dimension(140, 59));

        userLabel.setBackground(new java.awt.Color(153, 153, 153));
        userLabel.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        userLabel.setText("Usuário:");

        userRespLabel.setBackground(new java.awt.Color(153, 153, 153));
        userRespLabel.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
        userRespLabel.setText("Vanessa Demani dos Santos");

        dataLabel.setBackground(new java.awt.Color(153, 153, 153));
        dataLabel.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        dataLabel.setText("Data:");

        dataRespLabel.setBackground(new java.awt.Color(153, 153, 153));
        dataRespLabel.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N
        dataRespLabel.setText("jLabel4");

        horaLabel.setBackground(new java.awt.Color(153, 153, 153));
        horaLabel.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        horaLabel.setText("Hora:");

        horaRespLabel.setBackground(new java.awt.Color(153, 153, 153));
        horaRespLabel.setFont(new java.awt.Font("Times New Roman", 3, 14)); // NOI18N

        javax.swing.GroupLayout footerPanelLayout = new javax.swing.GroupLayout(footerPanel);
        footerPanel.setLayout(footerPanelLayout);
        footerPanelLayout.setHorizontalGroup(
            footerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(footerPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(userLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(userRespLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 804, Short.MAX_VALUE)
                .addComponent(dataLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(dataRespLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(horaLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(horaRespLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        footerPanelLayout.setVerticalGroup(
            footerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, footerPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(footerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(horaRespLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(footerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(userLabel)
                        .addComponent(userRespLabel)
                        .addComponent(dataLabel)
                        .addComponent(dataRespLabel)
                        .addComponent(horaLabel)))
                .addContainerGap())
        );

        logoLabel.setBackground(new java.awt.Color(153, 153, 153));
        logoLabel.setOpaque(true);

        jMenuBar1.setBackground(new java.awt.Color(153, 153, 153));

        CadastroJmenu.setText("Cadastrar");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/add-female-user (2).png"))); // NOI18N
        jMenuItem1.setText("Cliente");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        CadastroJmenu.add(jMenuItem1);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/Coin-01 (2).png"))); // NOI18N
        jMenuItem2.setText("Forma Pagamento");
        CadastroJmenu.add(jMenuItem2);

        jMenuBar1.add(CadastroJmenu);

        jMenu2.setText("Venda");

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/Custom-Icon-Design-Pretty-Office-6-Shopping-basket-add (2).png"))); // NOI18N
        jMenuItem3.setText("Nova Venda");
        jMenu2.add(jMenuItem3);

        jMenuBar1.add(jMenu2);

        sairJmenu.setText("Sair");

        jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icon/Custom-Icon-Design-Pretty-Office-6-Logout (2).png"))); // NOI18N
        jMenuItem4.setText("Sair");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        sairJmenu.add(jMenuItem4);

        jMenuBar1.add(sairJmenu);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(footerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 1217, Short.MAX_VALUE)
            .addComponent(logoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(topPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(logoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 641, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(footerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
       CadClienteView.start("Cadastro de Clientes");
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
       confirmExit();
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
       confirmExit();
    }//GEN-LAST:event_formWindowClosing

    private void CadClienteBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CadClienteBtnActionPerformed
       CadClienteView.start("Cadastro de Clientes");
    }//GEN-LAST:event_CadClienteBtnActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                Home home = new Home();                                
                home.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);             
                home.setVisible(true);
                AjustaIcon.ajustaIconNoLabel(home.getLabel(), new ImageIcon(getClass().getResource("/Icon/Logo (2).png"))); 
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton CadClienteBtn;
    private javax.swing.JMenu CadastroJmenu;
    private javax.swing.JLabel dataLabel;
    private javax.swing.JLabel dataRespLabel;
    private javax.swing.JPanel footerPanel;
    private javax.swing.JLabel horaLabel;
    private javax.swing.JLabel horaRespLabel;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JToolBar jToolBar1;
    public javax.swing.JLabel logoLabel;
    private javax.swing.JMenu sairJmenu;
    private javax.swing.JPanel topPanel;
    private javax.swing.JLabel userLabel;
    private javax.swing.JLabel userRespLabel;
    private javax.swing.JButton vendaBtn;
    // End of variables declaration//GEN-END:variables

    private void confirmExit() {
        int resp = JOptionPane.showConfirmDialog(this, "Deseja confirmar a saida?", "Confirmação de Saida.", JOptionPane.OK_CANCEL_OPTION);
        if(resp == JOptionPane.OK_OPTION)
            System.exit(0);       
                   
    }
    public JLabel getLabel(){
        return this.logoLabel;
    }
}
